#include "CppUnitTest.h"
#include"../Modbus_tcp/tcp.h"
#include"mytext.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace UnitTest_tcp
{		
	TEST_CLASS(UnitTest1)
	{
	public:
		
		TEST_METHOD(TestMethod2)
		{
			char input[600];
			char* FileAddress = "../tcpanalysis.ini";
			int num = 0, i = 0;
			num = ReadSection(FileAddress);
			for (i = 0; i < num; i++)
			{
				Logger::WriteMessage("*1*");
				vector<byte> in;
				int res = GetPrivateProfileIntA(section[i], "out", 0, FileAddress);
				GetPrivateProfileStringA(section[i], "Input", 0, input, 600, FileAddress);
				string inp = input;
				if (inp.length() % 2 == 1)
					continue;
				stringtodec(inp, in);
				DATA d = analysis(in);
				string expect = input;
				Assert::AreEqual(res, d.normal);
				in.clear();
			}
		}

	};
}